//
//  ScrollViewCell.m
//  HappyTrip
//
//  Created by dlios on 15-3-24.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ScrollViewCell.h"

@implementation ScrollViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.array = [NSMutableArray array];
        self.view = [[UIView alloc] init];
        [self.contentView addSubview:self.view];
        [_view release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
//    self.view.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 20);
    self.view.frame = self.contentView.bounds;
    static NSInteger i = 0;
    if (i == 0) {
        NSArray *arr = [self.recommend.data objectAtIndex:0];
        for (NSInteger j = 0; j < arr.count; j++) {
            NSURL *url = [NSURL URLWithString:[[arr objectAtIndex:j] objectForKey:@"image_url"]];

            // NSData *data = [NSData dataWithContentsOfURL:url];
//            UIImage *view5 = [UIImage imageWithData:data];
//            NSLog(@"view4   %@", view5);
            [self.array addObject:url];

        }
        self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:self.view.bounds imagesGroup:self.array];
        self.cycleScrollView.autoScrollTimeInterval = 2.0;
        [self.view addSubview:self.cycleScrollView];
        i++;
        }
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
